<template>
  <div>
  <div class="bground">

  <div class="loginBox">
		<div class="loginContent">
			<label for='accountNumber'>账号:</label>
			<input id="accountNumber" type="text" placeholder="请输入账号" v-model="accDTO.accountNumber">
		</div>
		<div class="loginContent">
			<label for='accountPassword'>密码：</label>
			<input id="accountPassword" type="password" placeholder="请输入密码" v-model="accDTO.accountPassword">
		</div>
		<div>
			<el-button type="primary" text @click="login" >
    <router-link to="/home">登录</router-link>
    </el-button>
		</div>
	</div>
</div>

 
</div>
</template>

<script>
import { ElMessage } from "element-plus";
export default {
   
      data(){
        // Option:[
        //   {
        //     accountNumber:'张飒飒',
        //   accountPassword:1111
        //   },{
        //     accountNumber:'张而',
        //   accountPassword:1111
        //   }
        // ]
        return{
          accDTO:{
            accountNumber:"",
            accountPassword:""
          }
        }
      },
      methods:{
        login(){
            console.log("user:",this.accDTO)
            this.axios.post("/user/login",this.accDTO).then(res=>{
                console.log("登录返回对象：",res)
                if(res.code!=-1){
                    localStorage.setItem("token",res)
                    console.log("路由对象：",this.$router)
                    this.$router.push({path:'home'})
                }
            })
        }

        // loadData(){

        // }
      },
      mounted() {
			console.log('进入了login.vue')
		}
}
</script>

<style>


  .bground{
    background: url("../imgs/电脑办公登录.jpg") no-repeat;
    width: 100%;
    height: 100%;
    /* background-color: aqua; */
    position: fixed;
  
    background-size: 100% 100%;
  }

	.loginBox{
		padding: 50px;
    background-color: rgb(234, 247, 242);
		width: 400px;
		text-align: center;
		margin: 60px auto;
		border-radius: 10px;
	}
	#accountNumber,#accountPassword{
		width: 200px;
		height: 40px;
		text-indent: 10px;
		border: none;
		border-radius: 5px;
		margin-bottom: 30px;
		outline: none;
		
	}
    #accountPassword{
        position: relative;
        left: -8px;
    }
</style>